{$layout "layout_popup"}

<h3>添加规则集</h3>

<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
	<input type="hidden" name="groupId" :value="groupId"/>
	<table class="ui table definition selectable">
		<tr>
			<td class="title">规则集名称 *</td>
			<td>
				<input type="text" name="name" maxlength="100" ref="focus"/>
			</td>
		</tr>
		<tr>
			<td>规则</td>
			<td>
				<http-firewall-rules-box :v-rules="rules" :v-type="type"></http-firewall-rules-box>
			</td>
		</tr>
		<tr>
			<td>规则之间的关系</td>
			<td>
				<select class="ui dropdown" name="connector" style="width:10em" @change="changeConnector()" v-model="selectedConnector">
					<option v-for="connector in connectors" :value="connector.value">{{connector.name}}</option>
				</select>
				<p class="comment">{{selectedConnectorDescription}}</p>
			</td>
		</tr>
		<tr>
			<td :class="{'color-border':action == 'go_group' || action == 'go_set'}">动作</td>
			<td>
				<select class="ui dropdown auto-width" name="action" v-model="action">
					<option v-for="a in actions" :value="a.code">{{a.name}}({{a.code.toUpperCase()}})</option>
				</select>
				<p class="comment">匹配当前规则集后要执行的动作。</p>
			</td>
		</tr>
		<tr v-if="action == 'go_group'">
			<td class="color-border">下一个规则分组</td>
			<td>
				<select class="ui dropdown" name="action_groupId" style="width:12em" v-model="actionGroupId">
					<option v-for="g in firewallPolicy.inbound.groups" :value="g.id">{{g.name}}</option>
				</select>
				<p class="comment">当动作为"跳到下一个规则分组"时出现此选择。</p>
			</td>
		</tr>
		<tr v-if="action == 'go_set'">
			<td class="color-border">下一个规则分组</td>
			<td>
				<select class="ui dropdown" name="action_groupId" style="width:12em" v-model="actionGroupId">
					<option v-for="g in firewallPolicy.inbound.groups" :value="g.id">{{g.name}}</option>
				</select>
				<p class="comment">当动作为"跳到下一个规则集"时出现此选择。</p>
			</td>
		</tr>
		<tr v-if="action == 'go_set'">
			<td class="color-border">下一个规则集</td>
			<td>
				<select class="ui dropdown" name="action_setId" style="width:12em" v-model="actionSetId">
					<option v-for="r in groupSets(actionGroupId)" :value="r.id">{{r.name}}</option>
				</select>
				<p class="comment">当动作为"跳到下一个规则集"时出现此选择。</p>
			</td>
		</tr>
	</table>
	<submit-btn></submit-btn>
</form>